WPS Office.apk(点击下载) / PaperDownRepectDialog.java


package cn.wps.moffice.main.papercheck.impl;

import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.PorterDuff;
import android.net.Uri;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.FrameLayout;
import android.widget.TextView;
import cn.wps.moffice.OfficeApp;
import cn.wps.moffice.common.beans.CommonErrorPage;
import cn.wps.moffice.main.common.viewcontrols.LoadMoreListView;
import cn.wps.moffice.main.common.viewcontrols.ViewTitleBar;
import cn.wps.moffice_eng.R;
import com.baidu.tts.loopj.AsyncHttpResponseHandler;
import com.google.firebase.perf.FirebasePerformance;
import com.google.gson.reflect.TypeToken;
import com.mopub.nativeads.KS2SEventNative;
import defpackage.czq;
import defpackage.gye;
import defpackage.kia;
import java.io.DataOutputStream;
import java.io.File;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.EnumSet;
import java.util.Locale;
import java.util.TreeMap;
import java.util.zip.CRC32;
import org.json.JSONException;
import org.json.JSONObject;
import org.scribe.model.OAuthConstants;

public class PaperDownRepectDialog extends czq.a implements View.OnClickListener, gxu {
    private TextView diM;
    private long djg = System.currentTimeMillis();
    private int dmt;
    private boolean hIQ;
    private Runnable hIT = new Runnable() {
        /* class cn.wps.moffice.main.papercheck.impl.PaperDownRepectDialog.AnonymousClass8 */

        public final void run() {
            PaperDownRepectDialog.d(PaperDownRepectDialog.this);
        }
    };
    private CheckItemView hIU;
    private CheckItemView hIV;
    private CheckItemView hIW;
    private CheckItemView hIX;
    private CheckItemView hIY;
    private FrameLayout hIZ;
    gxy hJG;
    private ArrayList<gxy> hJH;
    private gyd hJI;
    private FrameLayout hJa;
    private Runnable hJb = new Runnable() {
        /* class cn.wps.moffice.main.papercheck.impl.PaperDownRepectDialog.AnonymousClass5 */

        public final void run() {
            if (PaperDownRepectDialog.this.hJG.hIz.length() > 15728640) {
                dwp.at("public_apps_paperdown_paperverify_failure", "filesize error");
                gyc.a(PaperDownRepectDialog.this.mActivity, PaperDownRepectDialog.this.mActivity.getString(R.string.paper_check_verify_file_oversize), PaperDownRepectDialog.this);
                return;
            }
            PaperDownRepectDialog.this.hIV.setFinished();
            fzc.bJM().c(PaperDownRepectDialog.this.hJc, 1000);
        }
    };
    private Runnable hJc = new Runnable() {
        /* class cn.wps.moffice.main.papercheck.impl.PaperDownRepectDialog.AnonymousClass6 */

        public final void run() {
            String name = PaperDownRepectDialog.this.hJG.hIz.getName();
            String substring = name.substring(0, name.lastIndexOf(46));
            if (TextUtils.isEmpty(substring)) {
                dwp.at("public_apps_paperdown_paperverify_failure", "title error");
                gyc.a(PaperDownRepectDialog.this.mActivity, PaperDownRepectDialog.this.mActivity.getString(R.string.paper_check_verify_empty_title), PaperDownRepectDialog.this);
            } else if (substring.length() > 30) {
                dwp.at("public_apps_paperdown_paperverify_failure", "title error");
                gyc.a(PaperDownRepectDialog.this.mActivity, PaperDownRepectDialog.this.mActivity.getString(R.string.paper_check_verify_title_too_long), PaperDownRepectDialog.this);
            } else {
                PaperDownRepectDialog.this.hJG.title = substring;
                PaperDownRepectDialog.this.hIW.setFinished();
                fzc.bJM().c(PaperDownRepectDialog.this.hJd, 1000);
            }
        }
    };
    private Runnable hJd = new Runnable() {
        /* class cn.wps.moffice.main.papercheck.impl.PaperDownRepectDialog.AnonymousClass7 */

        public final void run() {
            if (PaperDownRepectDialog.this.hJG.hIA < 1000) {
                dwp.at("public_apps_paperdown_paperverify_failure", "words error");
                gyc.a(PaperDownRepectDialog.this.mActivity, PaperDownRepectDialog.this.mActivity.getString(R.string.paper_check_verify_char_too_less, new Object[]{"1000"}), PaperDownRepectDialog.this);
            } else if (PaperDownRepectDialog.this.hJG.hIA > 100000) {
                dwp.at("public_apps_paperdown_paperverify_failure", "words error");
                gyc.a(PaperDownRepectDialog.this.mActivity, PaperDownRepectDialog.this.mActivity.getString(R.string.paper_check_verify_char_too_much, new Object[]{100000}), PaperDownRepectDialog.this);
            } else {
                PaperDownRepectDialog.this.bWx();
            }
        }
    };
    private Runnable hpy;
    private Activity mActivity;
    private View mRootView;
    private ViewTitleBar mTitleBar;

    public PaperDownRepectDialog(Activity activity) {
        super(activity, R.style.Dialog_Fullscreen_StatusBar_push_animations);
        this.mActivity = activity;
        bWv();
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void a(LoadMoreListView loadMoreListView, View view, View view2, gyd gyd) {
        this.hJa.setVisibility(8);
        gyd.hJq = this.hJH;
        gyd.notifyDataSetChanged();
        if (gyd.getCount() == 0) {
            view.setVisibility(0);
            loadMoreListView.setVisibility(4);
        } else {
            view.setVisibility(8);
            loadMoreListView.setVisibility(0);
            if (!gyd.hasMore) {
                loadMoreListView.setPullLoadEnable(false);
                view2.setVisibility(0);
                return;
            }
        }
        view2.setVisibility(8);
    }

    static /* synthetic */ void a(PaperDownRepectDialog paperDownRepectDialog, int i) {
        switch (i) {
            case -1:
                if (paperDownRepectDialog.isShowing()) {
                    paperDownRepectDialog.dmt = 4;
                    paperDownRepectDialog.hIZ.removeAllViews();
                    LayoutInflater.from(paperDownRepectDialog.mActivity).inflate(R.layout.public_phone_paper_check_failed_layout, paperDownRepectDialog.hIZ);
                    paperDownRepectDialog.diM.setText(R.string.paper_down_repetition_result_title);
                    paperDownRepectDialog.mRootView.findViewById(R.id.contact_custom_service).setOnClickListener(paperDownRepectDialog);
                    ((TextView) paperDownRepectDialog.hIZ.findViewById(R.id.text_checking)).setText(R.string.paper_down_repetition_failed);
                    View findViewById = paperDownRepectDialog.hIZ.findViewById(R.id.down_once_more);
                    findViewById.setVisibility(0);
                    findViewById.setOnClickListener(paperDownRepectDialog);
                    return;
                }
                return;
            case 0:
            case 1:
                if (paperDownRepectDialog.isShowing()) {
                    paperDownRepectDialog.dmt = 3;
                    paperDownRepectDialog.hIZ.removeAllViews();
                    paperDownRepectDialog.hJH = null;
                    LayoutInflater.from(paperDownRepectDialog.mActivity).inflate(R.layout.public_phone_paper_check_checking_layout, paperDownRepectDialog.hIZ);
                    paperDownRepectDialog.diM.setText(R.string.paper_down_repetition_downing_title);
                    ((TextView) paperDownRepectDialog.mRootView.findViewById(R.id.checking_history_left)).setText(R.string.paper_down_repetition_processing_left);
                    ((TextView) paperDownRepectDialog.mRootView.findViewById(R.id.text_checking)).setText(R.string.paper_down_repetition_downing);
                    TextView textView = (TextView) paperDownRepectDialog.mRootView.findViewById(R.id.checking_history);
                    textView.setText(R.string.paper_down_repetition_history);
                    textView.setOnClickListener(paperDownRepectDialog);
                    if (paperDownRepectDialog.hIT != null) {
                        fzc.bJM().c(paperDownRepectDialog.hIT, 10000);
                        return;
                    }
                    return;
                }
                return;
            case 2:
                if (paperDownRepectDialog.isShowing()) {
                    lvw.d(paperDownRepectDialog.getWindow(), false);
                    paperDownRepectDialog.dmt = 5;
                    paperDownRepectDialog.mRootView.findViewById(R.id.title_bar).setVisibility(8);
                    paperDownRepectDialog.hIZ.removeAllViews();
                    LayoutInflater.from(paperDownRepectDialog.mActivity).inflate(R.layout.public_paper_check_result_layout, paperDownRepectDialog.hIZ);
                    lvw.cm(paperDownRepectDialog.mRootView.findViewById(R.id.title));
                    Button button = (Button) paperDownRepectDialog.mRootView.findViewById(R.id.output_report);
                    button.getBackground().setColorFilter(-13200651, PorterDuff.Mode.SRC_IN);
                    button.setVisibility(0);
                    button.setText(R.string.paper_down_repetition_result_btn_text);
                    button.setOnClickListener(paperDownRepectDialog);
                    paperDownRepectDialog.mRootView.findViewById(R.id.btn_close).setOnClickListener(paperDownRepectDialog);
                    paperDownRepectDialog.hIZ.findViewById(R.id.paper_down_tips).setVisibility(0);
                    ((TextView) paperDownRepectDialog.mRootView.findViewById(R.id.title_text)).setText(paperDownRepectDialog.hJG.title);
                    ((TextView) paperDownRepectDialog.mRootView.findViewById(R.id.char_count)).setText(String.valueOf(paperDownRepectDialog.hJG.hIM));
                    ((TextView) paperDownRepectDialog.mRootView.findViewById(R.id.repeat_rate_title)).setText(R.string.paper_down_repetition_modify_count);
                    ((TextView) paperDownRepectDialog.mRootView.findViewById(R.id.repeat_rate)).setText(String.valueOf(paperDownRepectDialog.hJG.hIN));
                    View findViewById2 = paperDownRepectDialog.mRootView.findViewById(R.id.repeat_count_layout);
                    View findViewById3 = paperDownRepectDialog.mRootView.findViewById(R.id.div_line);
                    findViewById2.setVisibility(8);
                    findViewById3.setVisibility(8);
                    paperDownRepectDialog.hIZ.findViewById(R.id.author_layout).setVisibility(8);
                    TextView textView2 = (TextView) paperDownRepectDialog.hIZ.findViewById(R.id.report_info);
                    textView2.setText(R.string.paper_down_repetition_report_info);
                    textView2.setOnClickListener(paperDownRepectDialog);
                    textView2.setVisibility(0);
                    return;
                }
                return;
            default:
                return;
        }
    }

    private void bWv() {
        this.mRootView = LayoutInflater.from(this.mActivity).inflate(R.layout.public_phone_paper_check_main_layout, (ViewGroup) null);
        this.hIZ = (FrameLayout) this.mRootView.findViewById(R.id.container);
        Window window = getWindow();
        this.mTitleBar = (ViewTitleBar) this.mRootView.findViewById(R.id.title_bar);
        this.mTitleBar.setGrayStyle(window);
        this.mTitleBar.setIsNeedMultiDocBtn(false);
        this.mTitleBar.setTitleText(R.string.paper_check_verify);
        this.diM = this.mTitleBar.qN;
        this.mTitleBar.gBO.setOnClickListener(this);
        this.hJa = (FrameLayout) this.mRootView.findViewById(R.id.circle_progressBar);
        if (window != null) {
            window.setSoftInputMode(32);
        }
        disableCollectDialogForPadPhone();
        setContentView(this.mRootView);
        show();
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void bWw() {
        TextView textView;
        if (!TextUtils.isEmpty(this.hJG.hIJ) && this.dmt == 2 && (textView = (TextView) this.mRootView.findViewById(R.id.paper_down_payed_tips)) != null) {
            textView.setVisibility(0);
        }
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void bWx() {
        dwp.lU("public_apps_paperdown_show");
        this.dmt = 2;
        this.hIZ.removeAllViews();
        LayoutInflater.from(this.mActivity).inflate(R.layout.public_phone_paper_check_begin_check_layout, this.hIZ);
        TextView textView = (TextView) this.mRootView.findViewById(R.id.start_check);
        textView.getBackground().setColorFilter(-13200651, PorterDuff.Mode.SRC_IN);
        textView.setText(R.string.paper_down_repetition_start);
        textView.setOnClickListener(this);
        TextView textView2 = (TextView) this.mRootView.findViewById(R.id.check_info);
        textView2.setText(R.string.paper_down_repetition_info);
        textView2.setOnClickListener(this);
        this.mRootView.findViewById(R.id.author_layout).setVisibility(8);
        this.mRootView.findViewById(R.id.div2).setVisibility(8);
        this.diM.setText(R.string.paper_check_verify_doc);
        this.hIZ.findViewById(R.id.paper_down_tips).setVisibility(0);
        ((TextView) this.mRootView.findViewById(R.id.paper_title)).setText(this.hJG.title);
        ((TextView) this.mRootView.findViewById(R.id.paper_check_char_num)).setText(this.mActivity.getString(R.string.paper_check_char_count, new Object[]{String.valueOf(this.hJG.hIA)}));
        bWw();
    }

    private void cC(String str, String str2) {
        czq czq = new czq(this.mActivity);
        czq.setTitle(str);
        czq.setMessage(str2);
        czq.setPositiveButton(R.string.home_task_know, (DialogInterface.OnClickListener) null);
        czq.disableCollectDilaogForPadPhone();
        czq.setCanceledOnTouchOutside(false);
        czq.setOnKeyListener(new DialogInterface.OnKeyListener() {
            /* class cn.wps.moffice.main.papercheck.impl.PaperDownRepectDialog.AnonymousClass3 */

            public final boolean onKey(DialogInterface dialogInterface, int i, KeyEvent keyEvent) {
                return 4 == i && keyEvent.getAction() == 1;
            }
        });
        czq.getPositiveButton().setTextColor(-1162898);
        czq.show();
    }

    static /* synthetic */ void d(PaperDownRepectDialog paperDownRepectDialog) {
        new fcv<Void, Void, Integer>(paperDownRepectDialog.hJG, new gye.a<Integer>() {
            /* class cn.wps.moffice.main.papercheck.impl.PaperDownRepectDialog.AnonymousClass4 */

            /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
            @Override // defpackage.gye.a
            public final /* synthetic */ void Q(Integer num) {
                PaperDownRepectDialog.a(PaperDownRepectDialog.this, num.intValue());
            }
        }) {
            /* class defpackage.gye.AnonymousClass3 */
            final /* synthetic */ gxy hJL;
            final /* synthetic */ a hJM;

            {
                this.hJL = r1;
                this.hJM = r2;
            }

            private Integer axO() {
                try {
                    TreeMap treeMap = new TreeMap();
                    treeMap.put("order_id", this.hJL.hIJ);
                    JSONObject jSONObject = new JSONObject(new JSONObject(lwd.f(String.format("https://wpsmapi.bigan.net/api/v2/task/state.html?order_id=%s&appid=1001&sig=%s", this.hJL.hIJ, gye.e(treeMap)), null)).optString("body"));
                    this.hJL.state = jSONObject.optInt("state");
                    if (this.hJL.state == 2) {
                        this.hJL.hIN = jSONObject.optString("drop_count");
                        this.hJL.hIM = jSONObject.optInt("word_count");
                    }
                    return Integer.valueOf(this.hJL.state);
                } catch (IOException | JSONException e) {
                    e.printStackTrace();
                    return 0;
                }
            }

            /* Return type fixed from 'java.lang.Object' to match base method */
            /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object[]] */
            /* access modifiers changed from: protected */
            @Override // defpackage.fcv
            public final /* synthetic */ Integer doInBackground(Void[] voidArr) {
                return axO();
            }

            /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
            /* access modifiers changed from: protected */
            @Override // defpackage.fcv
            public final /* synthetic */ void onPostExecute(Integer num) {
                Integer num2 = num;
                if (this.hJM != null) {
                    this.hJM.Q(num2);
                }
            }
        }.execute(new Void[0]);
    }

    @Override // defpackage.gxu
    public final void a(gxy gxy, Runnable runnable) {
        dwp.lU("public_apps_paperdown_paperverify_show");
        this.hpy = runnable;
        this.hJG = gxy;
        this.dmt = 1;
        LayoutInflater.from(this.mActivity).inflate(R.layout.public_phone_paper_check_verify_layout, this.hIZ);
        ((TextView) this.mRootView.findViewById(R.id.title)).setText(R.string.paper_check_verifying);
        ((TextView) this.mRootView.findViewById(R.id.verify_sub_title)).setText(R.string.paper_down_repetition_verify_sub_title);
        this.hIU = (CheckItemView) this.mRootView.findViewById(R.id.item_check_format);
        this.hIV = (CheckItemView) this.mRootView.findViewById(R.id.item_check_size);
        this.hIW = (CheckItemView) this.mRootView.findViewById(R.id.item_check_title);
        this.hIX = (CheckItemView) this.mRootView.findViewById(R.id.item_check_char);
        this.hIY = (CheckItemView) this.mRootView.findViewById(R.id.item_check_auth);
        this.hIY.setVisibility(8);
        this.hIU.setTitle(R.string.paper_check_verify_format);
        this.hIV.setTitle(R.string.paper_check_verify_size);
        this.hIW.setTitle(R.string.paper_check_verify_title);
        this.hIX.setTitle(R.string.paper_check_verify_char);
        if (!this.hJG.hIB) {
            dwp.at("public_apps_paperdown_paperverify_failure", "type error");
            gyc.a(this.mActivity, this.mActivity.getString(R.string.paper_check_verify_wrong_format), this);
            return;
        }
        this.hIU.setFinished();
        fzc.bJM().c(this.hJb, 1000);
    }

    @Override // defpackage.gxu
    public final void bWl() {
        this.dmt = 6;
        this.hIQ = true;
        if (this.mRootView == null) {
            bWv();
        } else {
            lvw.d(getWindow(), true);
        }
        fzc.bJM().z(this.hIT);
        this.hIZ.removeAllViews();
        LayoutInflater.from(this.mActivity).inflate(R.layout.public_phone_paper_check_history_layout, this.hIZ);
        this.diM.setText(R.string.paper_down_repetition_history);
        final CommonErrorPage commonErrorPage = (CommonErrorPage) this.mRootView.findViewById(R.id.network_error_layout);
        final CommonErrorPage commonErrorPage2 = (CommonErrorPage) this.mRootView.findViewById(R.id.empty_tips);
        commonErrorPage2.nS(R.string.paper_down_repetition_select_file).a(this);
        final LoadMoreListView loadMoreListView = (LoadMoreListView) this.mRootView.findViewById(R.id.history_list);
        commonErrorPage.a(new View.OnClickListener() {
            /* class cn.wps.moffice.main.papercheck.impl.PaperDownRepectDialog.AnonymousClass14 */

            public final void onClick(View view) {
                commonErrorPage.setVisibility(8);
                PaperDownRepectDialog.this.bWl();
            }
        }).setVisibility(8);
        if (!lwd.hu(this.mActivity)) {
            commonErrorPage.setVisibility(0);
            commonErrorPage2.setVisibility(8);
            loadMoreListView.setVisibility(4);
            return;
        }
        this.mTitleBar.setVisibility(0);
        this.hJa.setVisibility(0);
        if (this.hJI == null) {
            this.hJI = new gyd();
        }
        final View inflate = LayoutInflater.from(this.mActivity).inflate(R.layout.public_phone_paper_down_history_footer_layout, (ViewGroup) loadMoreListView, false);
        inflate.findViewById(R.id.contact_custom_service).setOnClickListener(this);
        loadMoreListView.addFooterView(inflate, null, false);
        loadMoreListView.setAdapter(this.hJI);
        loadMoreListView.setPullLoadEnable(true);
        loadMoreListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            /* class cn.wps.moffice.main.papercheck.impl.PaperDownRepectDialog.AnonymousClass15 */

            @Override // android.widget.AdapterView.OnItemClickListener
            public final void onItemClick(AdapterView<?> adapterView, View view, int i, long j) {
                gxy gxy = (gxy) loadMoreListView.getItemAtPosition(i);
                PaperDownRepectDialog.this.hJG = gxy;
                PaperDownRepectDialog.a(PaperDownRepectDialog.this, gxy.state);
            }
        });
        loadMoreListView.setCalledback(new LoadMoreListView.a() {
            /* class cn.wps.moffice.main.papercheck.impl.PaperDownRepectDialog.AnonymousClass16 */

            @Override // cn.wps.moffice.main.common.viewcontrols.LoadMoreListView.a
            public final void aus() {
                if (PaperDownRepectDialog.this.hJI.hasMore) {
                    new fcv<Void, Void, ArrayList<gxy>>(PaperDownRepectDialog.this.hJI, loadMoreListView, inflate) {
                        /* class defpackage.gye.AnonymousClass5 */
                        final /* synthetic */ LoadMoreListView hJK;
                        final /* synthetic */ gyd hJN;
                        final /* synthetic */ View hJj;

                        {
                            this.hJN = r1;
                            this.hJK = r2;
                            this.hJj = r3;
                        }

                        private ArrayList<gxy> bMt() {
                            fno bBh = fok.bBq().geJ.bBh();
                            if (bBh == null || !lwd.hu(OfficeApp.arx())) {
                                return null;
                            }
                            try {
                                String valueOf = String.valueOf(this.hJN.getCount());
                                TreeMap treeMap = new TreeMap();
                                treeMap.put("uid", bBh.userId);
                                treeMap.put("from", valueOf);
                                JSONObject optJSONObject = new JSONObject(lwd.f(String.format("https://wpsmapi.bigan.net/api/v2/result/history.html?uid=%s&from=%s&appid=1001&sig=%s", bBh.userId, valueOf, gye.e(treeMap)), null)).optJSONObject("body");
                                String optString = optJSONObject.optString("rows");
                                this.hJN.hasMore = optJSONObject.optBoolean("has_more");
                                return (ArrayList) lvb.b(optString, new TypeToken<ArrayList<gxy>>() {
                                    /* class defpackage.gye.AnonymousClass5.AnonymousClass1 */
                                }.getType());
                            } catch (IOException | JSONException e) {
                                e.printStackTrace();
                                return null;
                            }
                        }

                        /* Return type fixed from 'java.lang.Object' to match base method */
                        /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object[]] */
                        /* access modifiers changed from: protected */
                        @Override // defpackage.fcv
                        public final /* synthetic */ ArrayList<gxy> doInBackground(Void[] voidArr) {
                            return bMt();
                        }

                        /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
                        /* access modifiers changed from: protected */
                        @Override // defpackage.fcv
                        public final /* synthetic */ void onPostExecute(ArrayList<gxy> arrayList) {
                            ArrayList<gxy> arrayList2 = arrayList;
                            if (!this.hJN.hasMore) {
                                this.hJK.lv(false);
                                this.hJK.setPullLoadEnable(false);
                                this.hJK.bIy();
                                this.hJj.setVisibility(0);
                            } else {
                                this.hJK.setPullLoadEnable(true);
                            }
                            if (arrayList2 != null && arrayList2.size() > 0) {
                                gye.l(arrayList2);
                                gyd gyd = this.hJN;
                                gyd.hJq.addAll(arrayList2);
                                gyd.notifyDataSetChanged();
                            }
                        }
                    }.execute(new Void[0]);
                }
            }

            @Override // cn.wps.moffice.main.common.viewcontrols.LoadMoreListView.a
            public final void aut() {
            }

            @Override // cn.wps.moffice.main.common.viewcontrols.LoadMoreListView.a
            public final void auu() {
            }

            @Override // cn.wps.moffice.main.common.viewcontrols.LoadMoreListView.a
            public final void auv() {
            }
        });
        if (this.hJH != null) {
            a(loadMoreListView, commonErrorPage2, inflate, this.hJI);
        } else {
            new fcv<Void, Void, ArrayList<gxy>>(this.hJI, new gye.a<ArrayList<gxy>>() {
                /* class cn.wps.moffice.main.papercheck.impl.PaperDownRepectDialog.AnonymousClass2 */

                /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
                @Override // defpackage.gye.a
                public final /* synthetic */ void Q(ArrayList<gxy> arrayList) {
                    PaperDownRepectDialog.this.hJH = arrayList;
                    PaperDownRepectDialog.this.a(loadMoreListView, commonErrorPage2, inflate, PaperDownRepectDialog.this.hJI);
                }
            }) {
                /* class defpackage.gye.AnonymousClass4 */
                final /* synthetic */ a hJM;
                final /* synthetic */ gyd hJN;

                {
                    this.hJN = r1;
                    this.hJM = r2;
                }

                private ArrayList<gxy> bMt() {
                    fno bBh = fok.bBq().geJ.bBh();
                    if (bBh == null || !lwd.hu(OfficeApp.arx())) {
                        return null;
                    }
                    try {
                        TreeMap treeMap = new TreeMap();
                        treeMap.put("uid", bBh.userId);
                        treeMap.put("from", "0");
                        JSONObject optJSONObject = new JSONObject(lwd.f(String.format("https://wpsmapi.bigan.net/api/v2/result/history.html?uid=%s&from=%s&appid=1001&sig=%s", bBh.userId, "0", gye.e(treeMap)), null)).optJSONObject("body");
                        String optString = optJSONObject.optString("rows");
                        this.hJN.hasMore = optJSONObject.optBoolean("has_more");
                        return (ArrayList) lvb.b(optString, new TypeToken<ArrayList<gxy>>() {
                            /* class defpackage.gye.AnonymousClass4.AnonymousClass1 */
                        }.getType());
                    } catch (IOException | JSONException e) {
                        e.printStackTrace();
                        return null;
                    }
                }

                /* Return type fixed from 'java.lang.Object' to match base method */
                /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object[]] */
                /* access modifiers changed from: protected */
                @Override // defpackage.fcv
                public final /* synthetic */ ArrayList<gxy> doInBackground(Void[] voidArr) {
                    return bMt();
                }

                /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
                /* access modifiers changed from: protected */
                @Override // defpackage.fcv
                public final /* synthetic */ void onPostExecute(ArrayList<gxy> arrayList) {
                    ArrayList<gxy> arrayList2 = arrayList;
                    if (this.hJM != null) {
                        gye.l(arrayList2);
                        this.hJM.Q(arrayList2);
                    }
                }
            }.execute(new Void[0]);
        }
    }

    @Override // defpackage.czq.a
    public void dismiss() {
        if (this.hpy != null) {
            this.hpy.run();
        }
        fzc.bJM().z(this.hIT);
        fzc.bJM().z(this.hJb);
        fzc.bJM().z(this.hJc);
        fzc.bJM().z(this.hJd);
        this.hIQ = false;
        this.hIT = null;
        this.hJb = null;
        this.hJc = null;
        this.hJb = null;
        this.hJd = null;
        super.dismiss();
    }

    public void onBackPressed() {
        if ((this.dmt == 5 || this.dmt == 3) && this.hIQ) {
            bWl();
            return;
        }
        super.onBackPressed();
        dismiss();
    }

    public void onClick(View view) {
        boolean z;
        long currentTimeMillis = System.currentTimeMillis();
        if (Math.abs(currentTimeMillis - this.djg) < 200) {
            z = false;
        } else {
            this.djg = currentTimeMillis;
            z = true;
        }
        if (z) {
            switch (view.getId()) {
                case R.id.btn_close /*{ENCODED_INT: 2131362163}*/:
                case R.id.titlebar_backbtn /*{ENCODED_INT: 2131368677}*/:
                    onBackPressed();
                    return;
                case R.id.check_info /*{ENCODED_INT: 2131362257}*/:
                    dwp.lU("public_apps_paperdown_knowledge");
                    cC(this.mActivity.getString(R.string.paper_down_repetition_info), this.mActivity.getString(R.string.paper_down_repetition_info_text));
                    return;
                case R.id.checking_history /*{ENCODED_INT: 2131362279}*/:
                    dwp.lU("public_apps_paperdown_historylist");
                    fzc.bJM().z(this.hIT);
                    bWl();
                    return;
                case R.id.contact_custom_service /*{ENCODED_INT: 2131362423}*/:
                    try {
                        this.mActivity.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(this.mActivity.getString(R.string.wps_contact_qq_help))));
                        return;
                    } catch (ActivityNotFoundException e) {
                        lvg.d(this.mActivity, R.string.home_please_install_qq, 0);
                        return;
                    }
                case R.id.down_once_more /*{ENCODED_INT: 2131362734}*/:
                    bWx();
                    return;
                case R.id.output_report /*{ENCODED_INT: 2131365508}*/:
                    dwp.lU("public_apps_paperdown_report");
                    final czy czy = new czy(this.mActivity, R.string.paper_down_repetition_result_loading, false, new View.OnClickListener() {
                        /* class cn.wps.moffice.main.papercheck.impl.PaperDownRepectDialog.AnonymousClass11 */

                        public final void onClick(View view) {
                        }
                    });
                    czy.show();
                    Calendar instance = Calendar.getInstance();
                    instance.setTimeInMillis(this.hJG.time * 1000);
                    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmm", Locale.CHINA);
                    final String str = OfficeApp.arx().arM().lZQ + this.hJG.hIJ + File.separator + OfficeApp.arx().getString(R.string.paper_down_repetition_result_file_name, new Object[]{this.hJG.title, simpleDateFormat.format(instance.getTime())});
                    new fcv<Void, Void, Void>(this.hJG, new gye.a<Void>() {
                        /* class cn.wps.moffice.main.papercheck.impl.PaperDownRepectDialog.AnonymousClass12 */

                        /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
                        @Override // defpackage.gye.a
                        public final /* synthetic */ void Q(Void r8) {
                            if (TextUtils.isEmpty(PaperDownRepectDialog.this.hJG.file)) {
                                czy.axW();
                                lvg.d(PaperDownRepectDialog.this.mActivity, R.string.paper_down_repetition_download_fail_msg, 0);
                                return;
                            }
                            File file = new File(str);
                            if (file.exists()) {
                                file.delete();
                            }
                            PaperDownRepectDialog paperDownRepectDialog = PaperDownRepectDialog.this;
                            String str = PaperDownRepectDialog.this.hJG.file;
                            czy czy = czy;
                            if (file.getParentFile() != null && !file.getParentFile().exists()) {
                                file.getParentFile().mkdirs();
                            }
                            kia.c.meV.b(new khz(paperDownRepectDialog.hJG.hIJ.hashCode(), str, file.getPath()), new kia.d(czy, file) {
                                /* class cn.wps.moffice.main.papercheck.impl.PaperDownRepectDialog.AnonymousClass13 */
                                final /* synthetic */ File cwi;
                                final /* synthetic */ czy hJp;

                                {
                                    this.hJp = r2;
                                    this.cwi = r3;
                                }

                                @Override // defpackage.kia.d
                                public final void a(khz khz) {
                                }

                                @Override // defpackage.kia.d
                                public final void b(khz khz) {
                                }

                                @Override // defpackage.kia.d
                                public final void c(khz khz) {
                                    if (!this.hJp.cPS) {
                                        edk.a((Context) PaperDownRepectDialog.this.mActivity, this.cwi.getPath(), false, (edn) null, false);
                                    }
                                    this.hJp.axW();
                                }

                                @Override // defpackage.kia.d
                                public final void d(khz khz) {
                                    this.hJp.axW();
                                    lvg.d(PaperDownRepectDialog.this.mActivity, R.string.paper_down_repetition_download_fail_msg, 0);
                                }

                                @Override // defpackage.kia.d
                                public final void e(khz khz) {
                                }
                            });
                        }
                    }) {
                        /* class defpackage.gye.AnonymousClass6 */
                        final /* synthetic */ gxy hJL;
                        final /* synthetic */ a hJM;

                        {
                            this.hJL = r1;
                            this.hJM = r2;
                        }

                        private Void aLj() {
                            try {
                                TreeMap treeMap = new TreeMap();
                                treeMap.put("order_id", this.hJL.hIJ);
                                JSONObject jSONObject = new JSONObject(new JSONObject(lwd.f(String.format("https://wpsmapi.bigan.net/api/v2/result/view.html?order_id=%s&appid=1001&sig=%s", this.hJL.hIJ, gye.e(treeMap)), null)).optString("body"));
                                this.hJL.file = jSONObject.optString(KS2SEventNative.SCHEME_FILE);
                                this.hJL.md5 = jSONObject.optString("md5");
                            } catch (IOException | JSONException e) {
                                e.printStackTrace();
                            }
                            return null;
                        }

                        /* Return type fixed from 'java.lang.Object' to match base method */
                        /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object[]] */
                        /* access modifiers changed from: protected */
                        @Override // defpackage.fcv
                        public final /* synthetic */ Void doInBackground(Void[] voidArr) {
                            return aLj();
                        }

                        /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
                        /* access modifiers changed from: protected */
                        @Override // defpackage.fcv
                        public final /* synthetic */ void onPostExecute(Void r2) {
                            Void r22 = r2;
                            if (this.hJM != null) {
                                this.hJM.Q(r22);
                            }
                        }
                    }.execute(new Void[0]);
                    return;
                case R.id.public_common_error_btn /*{ENCODED_INT: 2131367135}*/:
                    EnumSet of = EnumSet.of(cqd.DOC_FOR_PAPER_CHECK);
                    Intent a = fvf.a(this.mActivity, (EnumSet<cqd>) of, false);
                    if (a != null) {
                        a.putExtra("file_type", of);
                        a.putExtra("guide_type", 17);
                        this.mActivity.startActivityForResult(a, 10000);
                        return;
                    }
                    return;
                case R.id.report_info /*{ENCODED_INT: 2131367698}*/:
                    dwp.lU("public_apps_paperdown_reportknowledge");
                    cC(this.mActivity.getString(R.string.paper_down_repetition_report_info), this.mActivity.getString(R.string.paper_down_repetition_report_info_text));
                    return;
                case R.id.start_check /*{ENCODED_INT: 2131368346}*/:
                    this.hJa.setVisibility(0);
                    dwp.lU("public_apps_paperdown_start");
                    if (!TextUtils.isEmpty(this.hJG.hIJ)) {
                        this.hJa.setVisibility(0);
                        new fcv<Void, Void, Boolean>(this.hJG, new gye.a<Boolean>() {
                            /* class cn.wps.moffice.main.papercheck.impl.PaperDownRepectDialog.AnonymousClass10 */

                            /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
                            @Override // defpackage.gye.a
                            public final /* synthetic */ void Q(Boolean bool) {
                                PaperDownRepectDialog.this.hJa.setVisibility(8);
                                if (bool.booleanValue()) {
                                    PaperDownRepectDialog.d(PaperDownRepectDialog.this);
                                } else {
                                    lvg.d(PaperDownRepectDialog.this.mActivity, R.string.paper_down_repetition_upload_fail_msg, 0);
                                }
                            }
                        }) {
                            /* class defpackage.gye.AnonymousClass2 */
                            final /* synthetic */ gxy hJL;
                            final /* synthetic */ a hJM;

                            {
                                this.hJL = r1;
                                this.hJM = r2;
                            }

                            private Boolean aTc() {
                                Throwable th;
                                DataOutputStream dataOutputStream;
                                fno bBh = fok.bBq().geJ.bBh();
                                if (bBh == null || !lwd.hu(OfficeApp.arx())) {
                                    return false;
                                }
                                DataOutputStream dataOutputStream2 = null;
                                try {
                                    CRC32 crc32 = new CRC32();
                                    crc32.update(this.hJL.hHo.getBytes());
                                    String encode = URLEncoder.encode(this.hJL.title, AsyncHttpResponseHandler.DEFAULT_CHARSET);
                                    TreeMap treeMap = new TreeMap();
                                    treeMap.put("order_id", this.hJL.hIJ);
                                    treeMap.put("user_id", bBh.userId);
                                    treeMap.put("title", this.hJL.title);
                                    treeMap.put("checksum", String.valueOf(crc32.getValue()));
                                    HttpURLConnection httpURLConnection = (HttpURLConnection) new URL(String.format("https://wpsmapi.bigan.net/api/v2/upload.html?order_id=%s&user_id=%s&title=%s&checksum=%s&appid=1001&sig=%s", this.hJL.hIJ, bBh.userId, encode, Long.valueOf(crc32.getValue()), gye.e(treeMap))).openConnection();
                                    httpURLConnection.setDoInput(true);
                                    httpURLConnection.setDoOutput(true);
                                    httpURLConnection.setRequestMethod(FirebasePerformance.HttpMethod.POST);
                                    httpURLConnection.setRequestProperty("x-amz-acl", "private");
                                    httpURLConnection.setRequestProperty("Content-Type", "application/ocet-stream");
                                    dataOutputStream = new DataOutputStream(httpURLConnection.getOutputStream());
                                    try {
                                        dataOutputStream.write(gye.yc(this.hJL.hHo));
                                        dataOutputStream.flush();
                                        if (httpURLConnection.getResponseCode() == 200) {
                                            Boolean valueOf = Boolean.valueOf(new JSONObject(lwd.z(httpURLConnection.getInputStream())).optInt(OAuthConstants.CODE) == 1);
                                            gyb.a(dataOutputStream);
                                            return valueOf;
                                        }
                                        gyb.a(dataOutputStream);
                                        return false;
                                    } catch (IOException e) {
                                        e = e;
                                        dataOutputStream2 = dataOutputStream;
                                        try {
                                            e.printStackTrace();
                                            gyb.a(dataOutputStream2);
                                            return false;
                                        } catch (Throwable th2) {
                                            th = th2;
                                            gyb.a(dataOutputStream2);
                                            throw th;
                                        }
                                    } catch (JSONException e2) {
                                        e = e2;
                                        dataOutputStream2 = dataOutputStream;
                                        e.printStackTrace();
                                        gyb.a(dataOutputStream2);
                                        return false;
                                    } catch (Throwable th3) {
                                        th = th3;
                                        dataOutputStream2 = dataOutputStream;
                                        gyb.a(dataOutputStream2);
                                        throw th;
                                    }
                                } catch (IOException e3) {
                                    e = e3;
                                    dataOutputStream = null;
                                    dataOutputStream2 = dataOutputStream;
                                    e.printStackTrace();
                                    gyb.a(dataOutputStream2);
                                    return false;
                                } catch (JSONException e4) {
                                    e = e4;
                                    e.printStackTrace();
                                    gyb.a(dataOutputStream2);
                                    return false;
                                }
                            }

                            /* Return type fixed from 'java.lang.Object' to match base method */
                            /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object[]] */
                            /* access modifiers changed from: protected */
                            @Override // defpackage.fcv
                            public final /* synthetic */ Boolean doInBackground(Void[] voidArr) {
                                return aTc();
                            }

                            /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
                            /* access modifiers changed from: protected */
                            @Override // defpackage.fcv
                            public final /* synthetic */ void onPostExecute(Boolean bool) {
                                Boolean bool2 = bool;
                                if (this.hJM != null) {
                                    this.hJM.Q(bool2);
                                }
                            }
                        }.execute(new Void[0]);
                        return;
                    }
                    hun hun = new hun();
                    hun.position = this.hJG.position;
                    hun.iPD = this.hJG;
                    hun.iPH = new hum() {
                        /* class cn.wps.moffice.main.papercheck.impl.PaperDownRepectDialog.AnonymousClass1 */
                    };
                    this.hJa.setVisibility(8);
                    crc asU = crc.asU();
                    Activity activity = this.mActivity;
                    asU.asW();
                    return;
                default:
                    return;
            }
        }
    }

    @Override // defpackage.dbd
    public void onWindowFocusChanged(boolean z) {
        super.onWindowFocusChanged(z);
        if (z && this.dmt <= 2 && TextUtils.isEmpty(this.hJG.hIJ)) {
            this.hJa.setVisibility(0);
            new fcv<Void, Void, gxy>(this.hJG, new gye.a<gxy>() {
                /* class cn.wps.moffice.main.papercheck.impl.PaperDownRepectDialog.AnonymousClass9 */

                /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
                @Override // defpackage.gye.a
                public final /* synthetic */ void Q(gxy gxy) {
                    PaperDownRepectDialog.this.hJa.setVisibility(8);
                    PaperDownRepectDialog.this.bWw();
                }
            }) {
                /* class defpackage.gye.AnonymousClass1 */
                final /* synthetic */ gxy hJL;
                final /* synthetic */ a hJM;

                {
                    this.hJL = r1;
                    this.hJM = r2;
                }

                private gxy bWy() {
                    fno bBh = fok.bBq().geJ.bBh();
                    if (bBh == null || !lwd.hu(OfficeApp.arx())) {
                        return null;
                    }
                    TreeMap treeMap = new TreeMap();
                    treeMap.put("uid", bBh.userId);
                    try {
                        JSONObject jSONObject = new JSONObject(lwd.f(String.format("https://wpsmapi.bigan.net/api/v2/pay/confirm.html?uid=%s&appid=1001&sig=%s", bBh.userId, gye.e(treeMap)), null));
                        if (jSONObject.optInt(OAuthConstants.CODE) == 1) {
                            JSONObject jSONObject2 = jSONObject.getJSONObject("body");
                            if (jSONObject2.optBoolean("need_buy")) {
                                this.hJL.hIK = jSONObject2.optString("ask_url");
                                this.hJL.hIL = jSONObject2.optString("notify_url");
                                this.hJL.hIJ = null;
                            } else {
                                this.hJL.hIJ = jSONObject2.optString("order_id");
                            }
                            return this.hJL;
                        }
                    } catch (IOException | JSONException e) {
                        e.printStackTrace();
                    }
                    return null;
                }

                /* Return type fixed from 'java.lang.Object' to match base method */
                /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object[]] */
                /* access modifiers changed from: protected */
                @Override // defpackage.fcv
                public final /* synthetic */ gxy doInBackground(Void[] voidArr) {
                    return bWy();
                }

                /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
                /* access modifiers changed from: protected */
                @Override // defpackage.fcv
                public final /* synthetic */ void onPostExecute(gxy gxy) {
                    gxy gxy2 = gxy;
                    if (this.hJM != null) {
                        this.hJM.Q(gxy2);
                    }
                }
            }.execute(new Void[0]);
        }
    }
}